package fpsf
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	
	public class ExternalLoading
	{
		private var load:URLLoader;
		
		public function ExternalLoading(url:String, assignTo:Array, runAfter:Function)
		{
			var req:URLRequest = new URLRequest(url);
			load = new URLLoader();
			load.addEventListener(Event.COMPLETE,function():void {ExternalLoadingComplete(assignTo, runAfter);},false);
			load.dataFormat = URLLoaderDataFormat.TEXT;
            load.load(req);
		}
		
		private function ExternalLoadingComplete(o:Array, f:Function):void
		{
			o[0] = load.data;
			f();
		}
	}
}